package com.demo;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext;

@MapperScan({"com.demo.**.mapper"})
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class, RedisRepositoriesAutoConfiguration.class})
public class Application extends SpringBootServletInitializer {

	public static void main(String[] args) {
	    SpringApplication app = new SpringApplication(Application.class);
        ConfigurableApplicationContext context = app.run(args);
        context.registerShutdownHook();//默认已经注册了shutdownhook
	}

	  /**
     * 部署在Web容器中,需要Servlet3.0
     */
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(Application.class);
    }
}
